require "rexml/document"
require "net/http"
require "uri"

languages = {
  "asp" => "ASP",
  "actionscript" => "ActionScript",
  "apache" => "Apache Log",
  "applescript" => "AppleScript",
  "bash" => "Bash",
  "c_mac" => "C",
  "c" => "C",
  "csharp" => "C#",
  "cpp-qt" => "C++",
  "cpp" => "C++",
  "cadlisp" => "CAD Lisp",
  "css" => "CSS",
  "cfm" => "ColdFusion",
  "dos" => "DOS",
  "diff" => "Diff",
  "eiffel" => "Eiffel",
  "html4strict" => "HTML",
  "ini" => "INI",
  "java" => "Java",
  "java5" => "Java  ",
  "javascript" => "Javascript",
  "latex" => "LaTeX",
  "lisp" => "Lisp",
  "lua" => "Lua",
  "reg" => "Microsoft Registry",
  "mysql" => "MySQL",
  "objc" => "Objective C",
  "oracle8" => "Oracle 8 SQL",
  "php-brief" => "PHP",
  "php" => "PHP",
  "plsql" => "PL/SQL",
  "perl" => "Perl",
  "python" => "Python",
  "rails" => "Rails",
  "ruby" => "Ruby",
  "sql" => "SQL",
  "smalltalk" => "Smalltalk",
  "smarty" => "Smarty",
  "text" => "Text",
  "vb" => "Visual Basic",
  "xml" => "XML",
  "robots" => "robots.txt",
  "vbnet" => "vb.net"
}

data = {
  :lang => languages.index("Ruby"),
  :code => File.open("file.txt", "r"){|f| f.read},
  :tabsize => "0", #0 means dont convert
}

#Requesting

url = URI.parse "http://geshi.simplesideias.com.br/index.php";
response = Net::HTTP.post_form(url, data).body;

#Threating

document = REXML::Document.new("<all>#{response}</all>");
p document.elements.to_a()



















